﻿
namespace LearnMAUI2.Services;

public class ContentNavigationService : IContentNavigationService
{
    private IRouteSerivice _routeSerivice;

    public ContentNavigationService(IRouteSerivice routeSerivice)
    {
        _routeSerivice= routeSerivice;
    }
    //Content导航使用相对地址，所以没有Root导航中的//
    public async Task NavigateToAsync(string page)
    {
        await Shell.Current.GoToAsync(_routeSerivice.GeteRoute(page));
    }
    //带参数传递
    public async Task NavigateToAsync(string page, object parameter)
    {
        await Shell.Current.GoToAsync($"{_routeSerivice.GeteRoute(page)}", new Dictionary<string, object>
        {
            ["parameter"] = parameter
        });
    }
}
